package com.medvalley.tcm.controller;

import com.medvalley.tcm.base.Result;
import com.medvalley.tcm.service.DictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author linsong
 * @date 2019/5/7 13:51
 **/
@RestController
@RequestMapping("/dictionary")
@Api("字典表接口")
public class DictionaryController extends BaseController {

    @Autowired
    private DictionaryService dictionaryService;

    @ApiOperation("医生职务")
    @RequestMapping(value = "/doctor/position", method = RequestMethod.GET)
    public Result listDoctorPosition() {
        List positions = dictionaryService.allDoctorPosition();
        return success(positions);
    }

    @ApiOperation("添加机构")
    @RequestMapping(value = "/org/add", method = RequestMethod.POST)
    public Result addOrg(@RequestParam String orgName) {
        dictionaryService.addOrg(orgName);
        return success();
    }

    @ApiOperation("机构列表")
    @RequestMapping(value = "/org/list", method = RequestMethod.GET)
    public Result addOrg() {
        List orgs = dictionaryService.listOrg();
        return success(orgs);
    }
}
